package com.qf.ssm.handler;

import com.qf.ssm.ex.BaseException;
import com.qf.ssm.result.ResponseResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author zhangwei
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    /**
     * @param ex
     * @return
     */
    @ExceptionHandler(BaseException.class)
    public ResponseResult<Object> handlerBaseException(BaseException ex) {
        ex.printStackTrace();
        return ResponseResult.error(ex.getResultStatus());
    }
    @ExceptionHandler(Exception.class)
    public ResponseResult<Object> handlerException(Exception ex) {
        ex.printStackTrace();
        return ResponseResult.error();
    }


}
